package thirteen.test01;

import java.io.File;
import java.io.FileFilter;

public class Test06 {
    public static void main(String[] args) {
        File dir = new File("./a");
        if (dir.isDirectory()){
            FileFilter filter = new FileFilter() {
                @Override
                public boolean accept(File pathname) {
                    String name = pathname.getName();
                    return name.matches("[\\S]+2[\\S]+");
                }
            };
            File[] subs = dir.listFiles(filter);
        //File[] subs = dir.listFiles(pathname -> pathname.getName().contains("2"));
            for (File sub:
                 subs) {
                System.out.println(sub);
            }
        }
    }
}
